package cn.itzzx.dubbo.filter;

import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.extension.Activate;
import com.alibaba.dubbo.rpc.*;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;
import java.util.Objects;

/**
 * @author: 韩逊
 * @date: 2020-05-01 20:35
 * @Description:
 */
@Activate(group = {Constants.PROVIDER})
public class TransportIPFilter implements Filter {
    @Override
    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
        String addr = RpcContext.getContext().getRemoteAddressString();
        System.out.println("请求地址:" + addr);
        return invoker.invoke(invocation);
    }
}
